<template>
	<view class="content">
		<view class="hover-view-1" hover-class="hover-view-style" hover-start-time="100">
			属性：hover-start-time;hover-stay-time;hover-stop-propagation;
		</view>
		<view> 滚动view测试--竖直滚动</view>
		<view class="scroll-container-y">
				<scroll-view scroll-y="true" class="scroll-y" @scrolltolower="handleScrollToLower" @scrolltoupper="handleScrollToUpper">
					<view class="scroll-item bg-blue">
						<span>demo-scroll-item-1</span>
					</view>
					<view class="scroll-item bg-green">
						<span>demo-scroll-item-2</span>
					</view>
					<view class="scroll-item bg-pink">
						<span>demo-scroll-item-3</span>
					</view>
				</scroll-view>
		</view>
		<view> 滚动view测试--横向滚动</view>
		<view class="scroll-container-x">
			<scroll-view 
			scroll-x="true" 
			scroll-left="120" 
			class="scroll-x" 
			@scroll="handleScroll" 
			@scrolltolower="handleScrollToLower" 
			@scrolltoupper="handleScrollToUpper">
				<view class="scroll-item-x bg-blue">
					<span>demo-scroll-item-1</span>
				</view>
				<view class="scroll-item-x bg-green">
					<span>demo-scroll-item-2</span>
				</view>
				<view class="scroll-item-x bg-pink">
					<span>demo-scroll-item-3</span>
				</view>
			</scroll-view>
		</view>
		
		<view>图标</view>
		<view class="item" v-for="(value,index) in iconType" :key="index">
		    <icon :type="value" size="26"/>
		    <text>{{value}}</text>
		</view>
		
		<view>进度条</view>
		<view>
			 <progress :percent="pro_1" show-info active active-mode="backwards" duration="100" @activeend="handleActiveFun"/>
			 <progress :percent="pro_2" show-info active active-mode="backwards" duration="100" @activeend="handleActiveFun"/>
		</view>
		<view>
			<button type="primary" @click="handleClick_normal">按钮一</button>
			<button type="warn" open-type="share" >分享</button>
			<button type="warn" open-type="getUserInfo" @getuserinfo="handleGetUserInfo">获取用户信息</button>
		</view>
		
		<view>
			<view>i跳转到其他页面</view>
			<view>
				<button type="default"  @click="handleNavigater('/pages/form_demo/form_demo')">form表单测试页面</button>
				<button type="primary" @click="handleNavigater('/pages/index/index')">index首页</button>
			</view>
		</view>
	</view>
</template>

<script>
	
	export default{
		  data() {
		        return {
		            iconType: ['success'],
					pro_1:83.1,
					pro_2:100.00,
		        }
		    },
		
		methods:{
			handleScrollToLower: function(){
				console.log('handleScrollToLower')
			},
			handleScrollToUpper:function(){
				console.log('handleScrollToUpper')
			},
			handleScroll: function(){
				console.log('handleScroll')
			},
			handleActiveFun: function(){
				console.log('progress is done')
			},
			handleClick_normal: function(){
				console.log('按钮测试');
			},
			handleGetUserInfo: function(value){
				console.log(value);
			},
			handleNavigater: function(url){
				console.log(url);
				uni.navigateTo({
					url:url,
					success: res =>{
						console.log(res);
					},
					fail: err => {
						console.log(err);
					}
				})
			},
		},
		
		   onLoad() {
		        // #ifdef APP-PLUS|| MP-WEIXIN
		        this.iconType = ['success', 'success_no_circle', 'info', 'warn', 'waiting', 'cancel', 'download', 'search','clear']
		        // #endif
		        // #ifdef MP-ALIPAY
		        this.iconType = ['info', 'warn', 'waiting', 'cancel', 'download', 'search', 'clear', 'success', 'success_no_circle', 'loading']
		        // #endif
		        // #ifdef MP-BAIDU
		        this.iconType = ['success', 'info', 'warn', 'waiting', 'success_no_circle', 'clear', 'search', 'personal', 'setting', 'top', 'close', 'cancel', 'download', 'checkboxSelected', 'radioSelected', 'radioUnselect']
		        // #endif
		    }
	}
</script>

<style>
	.hover-view-1{width: 100%;height: 100upx;background-color: #666;}
	.hover-view-style{background-color: lightblue;}
	.scroll-item{height: 200upx;display: flex;justify-content: center;align-items: center;}
	.scroll-y{height: 500upx;}
	.bg-green{background-color: lightgreen}
	.bg-blue{background-color: lightyellow}
	.bg-pink{background-color: lightpink}
	.scroll-x{height: 500upx;display:flex; background-color: #4CD964;white-space: nowrap;}
	.scroll-item-x{height:500upx;width: 500upx; display: inline-block;}
</style>
